package com.example.demo.RabittMQ;

import com.example.demo.util.JsonAndBean;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;

//发送者
@Service
public class RabittMQSender {

    @Autowired
    JsonAndBean jsonAndBean;

    @Autowired
    private AmqpTemplate amqpTemplate;


    public void sendMsg(Object object){
        String msg= jsonAndBean.BeanToJson(object);
        amqpTemplate.convertAndSend(RabittMQQueue.SECKILL_QUEUE,msg);
    }
}
